package com.example.qxfw.rcyw.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.qxfw.common.entity.ny.StationInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
@DS("service")
public interface StationInfoMapper extends BaseMapper<StationInfo> {

    @Select("select stationname " +
            "from station_info " +
            "where stationid like '%${stationid}%' " +
            "order by stationid ")
    List<String> selectName(String stationId);

    @Select("select stationid " +
            "from station_info " +
            "where stationname like '%${stationName}%' " )
    List<String> selectStationId(String stationName);

    @Select("select stationid, min((lon - ${jd}) * (lon - ${jd}) + (lat - ${wd}) * (lat - ${wd})) as lon " +
            "from station_info " +
            "order by lon " +
            "limit 1")
    List<StationInfo> selectList1(String jd, String wd);


    @Select("select stationid, stationname, county " +
            "from station_info " +
            "where lon is not null ")
    List<StationInfo> selectList2();

    @Select("select stationid\", \"stationname\", \"lon\", \"lat\", \"alti\", \"stationtype\", \"county\", \"township\", \"village\", \"maincrop\", \"basicsituation " +
            "from station_info ")
    List<StationInfo> selectList10();
}
